//=============================================================================
// BigShieldSphere - Absorbs hits.
//=============================================================================
class BigShieldSphere extends Actor;

var ShieldSentinel Shield;

replication
{
    reliable if(Role==Role_Authority)
        Shield;
}

//Intercept damage before Sentinel is hit.
function TakeDamage(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType)
{
	if(Shield != None)
		Shield.ShieldAbsorbDmg(Damage, EventInstigator, HitLocation, Momentum, DamageType);
}

//Make sure projectiles explode (or whatever they do when they hit solid walls) when they hit the shield.
singular function Touch(Actor Other)
{
    local actor ow;
	if(Other == None || !Other.IsA('Projectile'))
		return;

	//Don't block own projectiles on way out.
	if(pawn(Other)!=none) return;
	ow=other.owner;
	if((tfguardian(ow)!=none && tfguardian(ow).myteam==shield.myteam) || (pawn(ow)!=none && pawn(ow).PlayerReplicationInfo.Team.TeamIndex==Shield.myteam ))
		return;
	ow=other.owner.owner;
	if(pawn(ow)!=none && pawn(ow).PlayerReplicationInfo.Team.TeamIndex==Shield.myteam )
		return;

	Other.SetLocation(Other.Location + normal(Other.Location - Location) * 20); //Hack to stop grenades and things bouncing multiple times on contact.
	Other.HitWall(normal(Other.Location - Location), self);

	//For hit effects.
	if(Shield != None)
		Shield.ShieldAbsorbDmg(0, None, Other.Location, vect(0, 0, 0), class'DamageType');
}

function Destroyed()
{
    shield.ShieldDrawScale=self.DrawScale;
    super.destroyed();
}

defaultproperties
{
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'TFMedia.CollisionSphere'
     bAcceptsProjectors=False
     bUnlit=True
     bHardAttach=True
     bCollideActors=True
     bProjTarget=True
     bBlockActors=False
     bBlockProjectiles=False
     bBlockZeroExtentTraces=True
     bBlockNonZeroExtentTraces=True
}
